<template>
	<view>		
		<map  style="width: 100%; height: 85vh;" scale="15" :latitude="latitude" :longitude="longitude" :markers="covers">
		</map>
	</view>
</template>

<script>
	import helper from '../../common/helper.js'
	export default {
		data() {
			return {
				test:"哈哈哈",
				id:0, // 使用 marker点击事件 需要填写id				
				latitude: 30.581339,
				longitude: 103.989038,
				covers: [{
				        latitude:30.581339,
				        longitude:103.989038,						
						iconPath: '../../static/icon/location2.png',
						width:50,
						height:50,
						title:"高德地图"
				   },
				   // {
					  //  latitude: 30.587058,
					  //  longitude: 103.997879,
					  //  title:"百度定位",
					  //  width:50,
					  //  height:50,
					  //  iconPath: '../../static/icon/location.png'
				   // }
				   ],
				iconPath: '../../static/location.png'
			}
		},
		onLoad(option) {
			this.covers[0].title=option.str
			this.covers[0].latitude=option.lat
			this.covers[0].longitude=option.long
			this.latitude=option.lat
			this.longitude=option.long
		},
		// onLoad() {
		// 	console.log(helper.name)
		// 	uni.request({
		// 		url:"https://gljh.utools.club/food/resturand_locate/"+helper.name,
		// 		method:"POST",
		// 		success: (res) => {
		// 			console.log(res.data)
		// 			// this.covers[0].latitude=res.data.data.latitude
		// 			// this.covers[0].longitude=res.data.data.longitude
		// 			this.covers[0].latitude=30.580429
		// 			this.covers[0].longitude=103.983439
					
		// 		}
		// 	})
		// },

		methods: {
			getlocat(){
				uni.getLocation({
				    type: 'wgs84',
					altitude:true,
				    success: function (res) {
						this.covers[1].latitude=res.latitude
						this.covers[1].longitude=res.longitude
				        console.log('当前位置的经度：' + res.longitude);
				        console.log('当前位置的纬度：' + res.latitude);
				    }
				});
			}
		}
	}
</script>

<style>
</style>
